﻿/*Copyright (C) 2010-2012 RAAFCOM B.V. All rights reserved.

This file is part of Velsto and may be used under the terms of:
The GNU General Public License version 3 or higher, as published by
the Free Software Foundation.

This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.*/
/* 
 * Application  : Velsto
 * Class        : RunVelsimFile
 * 04/06/2010-  : M.A.van Ravesteijn (Raafcom)
 *   02/09/2011   Initial version v1.0
 *
 * 
 * Class for Batchjob Velsim
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Velsto
{
    public class RunVelsimFile
    {
        public RunVelsimFile()
        {
        }

        public string saveRunVelsimFile(SimulationEntity se,
                       string velsimexe, string inpfile, string runvelsimfile)
        {
            try
            {
                TextWriter rdFile = new StreamWriter(runvelsimfile);
                rdFile.WriteLine("\"" + velsimexe + "\" < \"" + inpfile + "\"");
                rdFile.WriteLine("IF ERRORLEVEL 1 EXIT 1");
                rdFile.Close();
                return null;
            }
            catch (Exception ex)
            {
                return ex.ToString();
            }
        }
    }
}
